//
//  LSZHeaderImageFootCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2017/12/22.
//  Copyright © 2017年 LC. All rights reserved.
//

#import "LSZHeaderImageFootCell.h"

@implementation LSZHeaderImageFootCell
//-(id)initWithOneFootHeaderImageView:(NSArray *)array
-(id)initWithOneFootHeaderImageViewWithManager:(LSZThumbUpOrBlessingListForResourcesManager *)mg
{
    self = [super  init];
    if (self) {
        CGFloat wids = (ScreenWidth-40)/6;
        for (int i = 0; i<mg.mutMgArray.count; i++) {
            UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20+ (i%6) * wids , 10+(i/6) * (wids+10), wids-10, wids-10)];
            [imageView.layer setMasksToBounds:YES];
            [imageView.layer setCornerRadius:(wids-10)/2];
            LSZThumbUpOrBlessingListForResourcesMg * manager = nil;
            manager = mg.mutMgArray[i];
            [imageView sd_setImageWithURL:[NSURL URLWithString:manager.praiserHead] placeholderImage:[UIImage imageNamed:@"placeholder"]];
             [imageView tapGesture:^(UIGestureRecognizer *ges) {
                int number = i;
                NSDictionary * dic = [[NSDictionary alloc]initWithObjectsAndKeys:@(number),@"number", nil];
                NSNotification *notification =[NSNotification notificationWithName:@"ClickThumbUpPeople" object:nil userInfo:dic];
                [[NSNotificationCenter defaultCenter] postNotification:notification];
                [[NSNotificationCenter defaultCenter] removeObserver:self name:@"ClickThumbUpPeople" object:nil];
            }];
            [self addSubview:imageView];
            if (i == mg.mutMgArray.count-1) {
                UILabel * labelLike = [[UILabel alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(imageView.frame)+10, ScreenWidth-40, 20)];
                labelLike.text = [NSString stringWithFormat:@"已有%lu人祝福",(unsigned long)mg.mutMgArray.count];
                labelLike.textColor = titleColorLSZ;
                [self addSubview:labelLike];
                if (ScreenWidth == 320) {
                    //5
                    labelLike.font = FONT_(13.5);
                }else if(ScreenWidth == 375){
                    // 6 7
                    labelLike.font = FONT_14;
                }else {
                    //plus
                    labelLike.font = FONT_(14.5);
                }
            }
        }
    }
    return self;
}
@end
